(function(window){
	var Subject_lessonCtrl = {
		data:{},
		init: function(data){
			this.bindEven();
			
        },
		 bindEven: function(){
            var bindings = [{
               // element:document,
                element:'.learnchapter h3',
                event:hiApp.device.click,
                handler: this.show_lesson
            }
			];
            bindEvents(bindings);
        },
		
		show_lesson:function(obj){
			var html=$(obj).html();
			if(typeof(html)=="undefined"){
				obj=$(this);
			}
			//obj=$(this);
			$(".learnchapter").each(function(i,v){
				var is_show=$(v).attr("is_show");
				if($(v).find(".unstyled").css("display")!="none" && is_show !=1){
					$(v).find(".unstyled").hide();
					$(v).find("h3 span").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
				}
				$(".learnchapter").attr("is_show",0);
			})
			//console.log($(this).parent().find(".unstyled").css("display"));
			if($(obj).parent().find(".unstyled").css("display")=="none"){
				$(obj).parent().find(".unstyled").show();
				$(obj).find("span").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
				$(obj).parent().attr("is_show",1);
			}else{
				$(obj).parent().find(".unstyled").hide();
				$(obj).find("span").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
			}
		}
		
    };
		
	window.BoxEdu_Subject_lessonCtrl = Subject_lessonCtrl;
						
})(window);